package com.ruoyi.web.controller.spoken;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.system.domain.SpokenTeacherTag;
import com.ruoyi.system.service.ISpokenTeacherTagService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@Api(description = "教师分类管理")
@RequestMapping("/spoken/teacherTag")
@RestController
public class TeacherTagController extends BaseController {

    @Autowired
    ISpokenTeacherTagService teacherTagService;

    @ApiOperation("教师分类列表")
    @GetMapping("/list")
    public TableDataInfo list(SpokenTeacherTag teacherTag){
        startPage();
        return getDataTable(teacherTagService.selectList(teacherTag));
    }

    @ApiOperation("添加教师分类")
    @PostMapping
    public AjaxResult add(@RequestBody SpokenTeacherTag teacherTag){
        return success(teacherTagService.insert(teacherTag));
    }

    @ApiOperation("查询教师分类")
    @GetMapping("/{tagId}")
    public AjaxResult getbyId(@PathVariable Long tagId){
        return success(teacherTagService.selectById(tagId));
    }

    @ApiOperation("修改教师分类")
    @PutMapping
    public AjaxResult edit(@RequestBody SpokenTeacherTag teacherTag){
        return success(teacherTagService.update(teacherTag));
    }

    @ApiOperation("删除教师分类")
    @DeleteMapping("/{tagId}")
    public AjaxResult remove(@PathVariable Long tagId){
        return success(teacherTagService.delete(tagId));
    }

}
